<!DOCTYPE html>
<html lang="en">
<include file="Common:common-head"/>
<body>

<div id="wrapper">

    <!-- Navigation -->
    <include file="Common:common-navbar"/>
    <div id="page-wrapper">
        <div class="row">
            <div class="col-lg-12">
                <h1 class="page-header">修改密码</h1>
            </div>
            <!-- /.col-lg-12 -->
        </div>
        <!-- /.row -->
        <div class="row">
            <div class="col-lg-12">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        修改密码
                    </div>
                    <div class="panel-body">
                        <div class="row">
                            <div class="col-lg-4">
                                <form role="form" action="{:U('update')}" method="post"
                                      enctype='multipart/form-data' id="Frm">
                                    <div class="form-group">
                                        <label>旧密码</label>
                                        <input type="password" name="oldpwd" id="oldpwd"
                                               class="form-control" required />
                                    </div>
                                    <div class="form-group">
                                        <label>新密码</label>
                                        <input type="password" name="newpwd" id="newpwd"
                                               class="form-control" required />
                                    </div>
                                    <div class="form-group">
                                        <label>再次确认密码</label>
                                        <input type="password" name="secondpwd" id="secondpwd"
                                               class="form-control" required />
                                    </div>
                                    <button type="submit" class="btn btn-next btn-default">确定提交</button>
                                </form>
                            </div>
                            <!-- /.col-lg-6 (nested) -->
                        </div>
                        <!-- /.row (nested) -->
                    </div>
                    <!-- /.panel-body -->
                </div>
                <!-- /.panel -->
            </div>
            <!-- /.col-lg-12 -->
        </div>
        <!-- /.row -->
    </div>
    <!-- /#page-wrapper -->

</div>

<include file="Common:common-script"/>
<script type="text/javascript" src="__PUBLIC__/js/bootstrapValidator.js"></script>
</body>

<script>
    $('#Frm').bootstrapValidator({
        message: 'This value is not valid',
        feedbackIcons: {
            valid: '',
            invalid: '',
            validating: 'glyphicon glyphicon-refresh'
        },
        fields: {
            oldpwd: {
                message: '',
                validators: {
                    notEmpty: {
                        message: '旧密码不能为空'
                    },
                    stringLength:{
                        min:6,
                        max:12,
                        message:'长度为6-12'
                    }
                }
            },
            newpwd: {
                message: '',
                validators: {
                    notEmpty: {
                        message: '新密码不能为空'
                    },
                    stringLength:{
                        min:6,
                        max:12,
                        message:'长度为6-12'
                    }
                }
            },
            secondpwd: {
                message: '',
                validators: {
                    notEmpty: {
                        message: '确认密码不能为空'
                    },
                    identical:{
                        field:'newpwd',
                        message:'和新密码不一样'
                    },//和密码不同的话报错
                    stringLength:{
                        min:6,
                        max:12,
                        message:'长度为6-12'
                    }
                }
            }
        }
    });
</script>
</html>
